package com.wuxq.serialportdemo;


import android.os.Bundle;
import android.util.Log;

import com.wuxq.serialport.SerialPortActivity;
import com.wuxq.serialport.Utils;


public class MainActivity extends SerialPortActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        start("/dev/ttyS2",115200,0);
    }

    @Override
    protected void onDataReceived(final byte[] buffer, int size) {
        runOnUiThread(new Runnable() {
            public void run() {
                String content = Utils.byte2Hex2(buffer);
                Log.d("wuxq","数据:"+content);
            }
        });
    }
}